import request from '@/router/axios';

// 获取排程列表详情
export const getList = () => {
  return request({
    url: '/api/mes-product/aps/productionplan/plan-detail-list',
    method: 'get'
  });
};

// 排程计算
export const planCalculating = (data) => {
  return request({
    url: '/api/mes-product/aps/productionplan/calculating',
    method: 'post',
    data
  });
};

// 保存排程
export const savePlan = (data) => {
  return request({
    url: '/api/mes-product/aps/productionplan/save',
    method: 'post',
    data
  });
};

// 更新排程
export const updatePlan = (data) => {
  return request({
    url: '/api/mes-product/aps/productionplan/update',
    method: 'post',
    data
  });
};

// 根据订单号查询所有产线列表
export const getLineListByProductionOrderNo = (params) => {
  return request({
    url: '/api/mes-product/aps/productionplan/line-list',
    method: 'get',
    params
  });
};

// 根据订单号查询所有bom列表
export const getBomListByProductionOrderNo = (params) => {
  return request({
    url: '/api/mes-product/aps/productionplan/bom-list',
    method: 'get',
    params
  });
};

// 根据订单号查询所有工艺路线列表
export const getProcessListByProductionOrderNo = (params) => {
  return request({
    url: '/api/mes-product/aps/productionplan/process-list',
    method: 'get',
    params
  });
};

// 根据订单号查询生产订单信息(已废弃)
// export const getProductionOrderByProductionOrderNo = (params) => {
//   return request({
//     url: '/api/mes-product/aps/productionplan/getProductionOrderByProductionOrderNo',
//     method: 'get',
//     params
//   });
// };
// 根据订单号查询排程计划信息
export const getProductionPlanByProductionOrderNo = (params) => {
  return request({
    url: '/api/mes-product/aps/productionplan/detail',
    method: 'get',
    params
  });
};

// 排程计划下发
export const planRelease = (params) => {
  return request({
    url: '/api/mes-product/aps/productionplan/release',
    method: 'get',
    params
  });
};

// 查询所有车间列表
export const getWorkshop = () => {
  return request({
    url: '/api/mes-admin/workshop/key-value',
    method: 'get'
  });
};

// 删除排程详情
export const deletePlan = (params) => {
  return request({
    url: '/api/mes-product/aps/productionplan/delete',
    method: 'delete',
    params
  });
};
